<?php

namespace Lite\Sql;

class ConnectionManager {
	
	/**
	 * Crea una instancia 
	 *
	 * @param string $driver
	 * 
	 * @return Connection
	 * 
	 * @throws new ConnectioException
	 */
	static function create($driver){
		$driver = ucfirst( strtolower( $driver ));
		
		$class = "Lite\\Sql\\{$driver}\\{$driver}Connection";
		
		if( class_exists( $class )) {
			return new $class;
		}
		
		throw new ConnectionException(
			"Driver {$driver} not available"
		);
	}
	
}
